export function setFavicon(url: string) {
  const prevLink = document.querySelector('link[rel=icon]')
  if (prevLink) prevLink.parentElement!.removeChild(prevLink)

  if (url) {
    const link = document.createElement('link')
    link.rel = 'icon'
    link.href = url
    document.querySelector('head')?.appendChild(link)
  }
}

export function setPageTitle(title: string) {
  document.title = title
}
